﻿@page "/admin/newsletter"

@using Microsoft.AspNetCore.Components.Authorization
@inject IJsonStringLocalizer<Settings> Localizer
@inject NavigationManager NavigationManager
@inject AuthenticationStateProvider AuthenticationStateProvider
@{
    var authState = AuthenticationStateProvider.GetAuthenticationStateAsync().Result;
    if (authState == null || !authState.User.Identity.IsAuthenticated)
    {
        try { NavigationManager.NavigateTo("account/login?returnUrl=/admin"); } catch { }
    }
}

<div class="container-fluid">

    <div class="row bf-row">
        <div class="col-lg-2 col-md col-sm bf-col"></div>
        <div class="col-lg-8 col-md-12 col-sm-12 bf-col">

            <ul class="nav nav-tabs" id="newsletter-tab" role="tablist">
                <li class="nav-item">
                    <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">@Localizer["newsletter"]</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">@Localizer["email"]</a>
                </li>
            </ul>
            <div class="tab-content" id="myTabContent">
                <div class="tab-pane tab-subscription fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">

                    <div class="card">
                        <div class="card-body">
                            <Subscription />
                        </div>
                    </div>

                </div>
                <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">

                    <div class="card">
                        <div class="card-body">
                            <EmailForm />
                        </div>
                    </div>

                </div>
            </div>

        </div>
        <div class="col-lg-2 col-md col-sm bf-col"></div>
    </div>

</div>